package day7;

import day5.chongwu.Dog;
import day5.chongwu.Pet;
import day5.chongwu.Tiger;
import day5.chongwu.bird.Parrot;

/**
 * @author oldliu
 * @since 1.0
 */
public class Zoo {
    private String name="肥东野生动物园";

    public Pet sell(int money){
        System.out.println("来到了"+name+"买点宠物");
        if(money>500000){
            System.out.println("买到了老虎。。。");
            return new Tiger("小美丽");
        }
        if(money>=100000){
            System.out.println("买到了狗。。。");
            return new Dog("哮天犬",989999,9999,"田园犬");
        }
        if(money>=200){
            System.out.println("买到了鹦鹉。。。");
            return new Parrot("小翠",500);
        }
        return null;
    }

    public static void main(String[] args) {
        Zoo z=new Zoo();
        int m=20;
        Pet sell = z.sell(m);
        if(sell==null){
            System.out.println("钱不够，没有买到");
        }else {
            sell.show();
            if(sell instanceof Tiger){
                System.out.println("买到了老虎。。。");
            }
        }
    }
}
